//! Service definition for daemons/servers that have an embedded wallet that
//! manages its own keys and which we can access remotely.

use crate::prelude::*;

use crate::addr;
use crate::asset;
use crate::service;
use crate::tx;

#[async_trait]
pub trait EmbWalletService {
    fn get_addr_referent(&self) -> addr::Referent;

    /// Check an address, potentially returning a parsed address.
    fn try_parse_addr(&self, addr: String) -> Result<Option<addr::Address>, service::SvcError>;

    /// Query all of the balances this embedded wallet claims to have.
    async fn get_balances(&self) -> Result<Vec<(asset::Asset, u64)>, service::SvcError>;

    /// Sends funds to an address.
    async fn send_to_address(
        &self,
        asset: asset::Asset,
        amt: u64,
        dest: addr::Address,
    ) -> Result<tx::TxId, service::SvcError>;
}
